package com.ssy.lingxi.report.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 商品中心操作类型枚举
 * @author 伍将
 * @date 2020/11/18
 * @version 2.0.0
 */
public enum CommodityOperateTypeEnum {

    /**
     * 待提交审核商品
     */
    TO_BE_PRODUCT_VALIFY_COMMIT(1, "待提交审核商品", "/memberCenter/commodityAbility/commodity/products"),
    /**
     * 待审核商品
     */
    TO_BE_PRODUCT_CHECK_COMMIT(6, "待审核商品", "/productManage/commodity/productWillCheck"),
    /**
     * 待上架商品
     */
    TO_BE_PRODUCT_PUBLISH(2, "待上架商品", "/memberCenter/commodityAbility/commodity/products"),
    /**
     * 待提交审核品牌
     */
    TO_BE_BRAND_VALIFY_COMMIT(3, "待提交审核品牌", "/memberCenter/commodityAbility/trademark/trademarkApply"),
    /**
     * 待审核品牌
     */
    TO_BE_BRAND_CHECK_COMMIT(7, "待审核品牌", "/productManage/trademark/trademarkWillCheck"),
    /**
     * 商品总数
     */
    PRODUCT_COUNT(4, "商品总数", "/memberCenter/commodityAbility/commodity/products"),
    /**
     * 品牌总数
     */
    BRAND_COUNT(5, "品牌总数", "/memberCenter/commodityAbility/trademark/trademarkApply");

    /**
     * 编码
     */
    private final Integer code;
    /**
     * 名称
     */
    private final String name;
    /**
     * 链接
     */
    private final String link;


    CommodityOperateTypeEnum(Integer code, String name, String link) {
        this.code = code;
        this.name = name;
        this.link = link;
    }

    public static CommodityOperateTypeEnum getEnum(Integer code) {
        return Arrays.stream(CommodityOperateTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }


    public Integer getCode() {
        return code;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public String getLink() {
        return link;
    }
}
